package com.situ.day2;

import org.junit.Test;

public class ForDemo {
	@Test
	public void test1() {
		for (int i = 1; i <= 5; i++) {
			System.out.println("HelloWorld!");
		}
	}
	
	//1+2+3+...+100=5050
	@Test
	public void test2() {
		int sum = 0;
		for (int i = 1; i <= 100; i++) {
			System.out.println(i);
			sum += i;
		}
		System.out.println("sum: " + sum);
	}
	
	// 计算1-100以内7的倍数的个数,
	@Test
	public void test55() {
		int count = 0;
		for (int i = 1; i <= 100; i++) {
			if (i % 7 == 0) {
				System.out.println(i);
				count++;
			}
		}
		System.out.println("7的倍数个数： " + count);
	}
	
	//****
	//****
	//****
	@Test
	public void test66() {
		//****
		for (int i = 1; i <= 4; i++) {
			System.out.print("*");
		}
		System.out.println();
		//*
		//*
		//*
		for (int i = 1; i <= 3; i++) {
			System.out.println("*");
		}
		System.out.println("--------------");
		// i j k
		for (int i = 1; i <= 3; i++) {//外层循环控制行数
			for (int j = 1; j <= 4; j++ ) {//内层循环每一行打印多少列
				System.out.print("*");
			}
			System.out.println();//打印完一行之后要换行打印下一行
		}
	}
	
	@Test
	public void test53() {
		for (int i = 1; i <= 5; i++) {
			for (int j = 1; j <= i; j++) {
				System.out.print("*");
			}
			System.out.println();
		}
	}
	
	@Test
	public void test54() {
		for (int i = 1; i <= 9; i++) {
			for (int j = 1; j <= i; j++) {
				//豆豆加加   
				//System.out.println("2*7=14");
				System.out.print(j + "*" + i + "=" + (i * j) + "\t");
			}
			System.out.println();
		}
	}
	
	
	
	
	
	
	
	
	
	
}
